//package com.muyu.common.security.utils;
//
//import com.muyu.common.core.domain.Result;
//
//import org.apache.http.HttpResponse;
//import org.apache.http.util.EntityUtils;
//
//
//import java.util.HashMap;
//import java.util.Map;
//
///**
// * 查询物流信息 CheckExpress
// *
// * @author LeYang
// * on 2025/1/21
// */
//public class CheckExpress {
//        public static void main(String[] args) {
//            String expressNo = "JT2111112856980";
//            String mobile = "8557";
//            Result<String> result = getExpress(expressNo, mobile);
//            System.out.println(result);
//        }
//
//        private static Result<String> getExpress(String expressNo, String mobile) {
//            String host = "https://kzexpress.market.alicloudapi.com";
//            String path = "/api-mall/api/express/query";
//            String method = "POST";
//            String appcode = "1fc6a963a7ca4ba9908203311d6eb43a";
//            Map<String, String> headers = new HashMap<>();
//            headers.put("Authorization", "APPCODE " + appcode);
//            headers.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
//            Map<String, String> bodys = new HashMap<>();
//            bodys.put("expressNo", expressNo);
//            bodys.put("mobile", mobile);
//
//            try {
//                HttpResponse response = HttpUtils.doPost(host, path, method, headers, new HashMap<>(), bodys);
//                String responseBody = EntityUtils.toString(response.getEntity());
//                JSONObject jsonResponse = new JSONObject(responseBody);
//
//                // 提取关键信息
//                JSONObject data = jsonResponse.getJSONObject("data");
//                String logisticsStatus = data.getString("logisticsStatus");
//                String logisticsStatusDesc = data.getString("logisticsStatusDesc");
//                String logisticsCompanyName = data.getString("logisticsCompanyName");
//                String mailNo = data.getString("mailNo");
//                JSONObject latestUpdate = new JSONObject();
//                latestUpdate.put("time", data.getString("theLastTime"));
//                latestUpdate.put("message", data.getString("theLastMessage"));
//
//                JSONArray logisticsTrace = data.getJSONArray("logisticsTraceDetailList");
//
//                JSONObject resultData = new JSONObject();
//                resultData.put("logisticsStatus", logisticsStatus);
//                resultData.put("logisticsStatusDesc", logisticsStatusDesc);
//                resultData.put("logisticsCompanyName", logisticsCompanyName);
//                resultData.put("mailNo", mailNo);
//                resultData.put("latestUpdate", latestUpdate);
//                resultData.put("logisticsTrace", logisticsTrace);
//
//                return Result.success(resultData.toString());
//            } catch (Exception e) {
//                e.printStackTrace();
//                return Result.error("Failed to fetch express information: " + e.getMessage());
//            }
//        }
//}
